package vip.meeet.bean;


public final class ResultHelper {

    private static final int DEFAULT_SUCCESS_CODE = 200;

    private static final int DEFAULT_FAIL_CODE = 500;

    private static final int UNLOGIN_CODE = 500;

    private static final String DEFAULT_SUCCESS_MESSAGE = "success";

    private static final String PARAM_ERROR_MESSAGE = "参数错误";

    private static final String SERVER_ERROR_MESSAGE = "服务执行异常";

    private static final String UNLOGIN_ERROR_MESSAGE = "请先登录";

//    private static final String DEFAULT_ERROR_MESSAGE = "fail";

    public static Result getDefaultSuccessResult(){
        return new Result(DEFAULT_SUCCESS_CODE,DEFAULT_SUCCESS_MESSAGE);
    }

    public static <T> Result getSuccessResult(T data){
        return new Result(DEFAULT_SUCCESS_CODE,DEFAULT_SUCCESS_MESSAGE,data);
    }

    public static Result getParamErrorResult(){
        return new Result(DEFAULT_FAIL_CODE,PARAM_ERROR_MESSAGE);
    }

    public static Result getUnLoginResult(){
        return new Result(UNLOGIN_CODE,UNLOGIN_ERROR_MESSAGE);
    }

    public static Result getErrorResult(String message){
        return new Result(DEFAULT_FAIL_CODE, message);
    }

    public static Result getServerErrorResult(){
        return new Result(DEFAULT_FAIL_CODE, SERVER_ERROR_MESSAGE);
    }


}
